using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class 全局配置 : MonoBehaviour
{
    private void Awake()
    {
        _inst = this;
    }

    private static 全局配置 _inst;
    public static 全局配置 Inst => _inst;

    public string DevOpsPublishAssetsPath = "Tool";
    public AssetLoadPathType 游戏模式;
    
    /// <summary>
    /// 获取加载路径
    /// </summary>
    /// <param name="assetLoadPathType"></param>
    public string GetLoadPath(AssetLoadPathType assetLoadPathType)
    {
        string path = "";
        //Editor下按照加载路径区分
        if (Application.isEditor)
        {
            switch (assetLoadPathType)
            {
                case AssetLoadPathType.Persistent:
                    path = Application.persistentDataPath;
                    break;
                case AssetLoadPathType.Editor:
                case AssetLoadPathType.StreamingAsset:
                {
                    path = Application.streamingAssetsPath;
                }
                    break;
                case AssetLoadPathType.DevOpsPublish:
                {
                    path = DevOpsPublishAssetsPath;
                }
                    break;
            }
        }
        else
        {
            //真机环境默认都在persistent下，因为需要io.不在的各个模块会自行拷贝
            path = Application.persistentDataPath;
        }

        return path;
    }
}


public enum AssetLoadPathType
{
    Editor = 0,

    /// <summary>
    /// 用户可读写沙盒
    /// </summary>
    Persistent,

    /// <summary>
    /// Streaming
    /// </summary>
    StreamingAsset,

    /// <summary>
    /// devop的发布目录
    /// </summary>
    DevOpsPublish
}